Imports System.Data.SqlClient

Partial Class sellerinfo
    Inherits System.Web.UI.Page
    Dim objrd As SqlDataReader = Nothing

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        Dim objdt = New GetData
        Dim ps = New PreparedStatement("")
        Dim objdtPro = New GetData
        Dim psPro = New PreparedStatement("")
        Dim comId As String
        comId = Request.QueryString("comId")
        Dim comInfo As String
        comInfo = ""
        Dim productInfo As String
        productInfo = ""
        Dim strErr As String = ""
        If comId <> Nothing And comId <> "" Then
            ps.strSql = "select * from merchants where company_id = @comId"
            ps.addParameter("comId", comId)
            Dim conn As SqlConnection = objdt.getConn()

            objrd = objdt.dr(ps, strErr, conn, objrd)
            If objrd.HasRows Then
                objrd.Read()
                comInfo &= "<div class=""companyTitle""> " & objrd.Item("merchant_name") & "</div>" & _
                        "<div class=""showLine""></div>" & _
                        "<table id=""companyTbInfo"" width=""100%"">" & _
                            "<tr>" & _
                                "<td class=""comName"">City:</td>" & _
                                "<td class=""comValue"">" & objrd.Item("city") & "</td>" & _
                                "<td class=""comName"">State:</td>" & _
                                "<td class=""comValue"">" & objrd.Item("state") & "</td>" & _
                            "</tr>" & _
                            "<tr>" & _
                                "<td class=""comName"">Contact Name:</td>" & _
                                "<td class=""comValue"">" & objrd.Item("contact_name") & "</td>" & _
                                "<td class=""comName"">Contact Phone:</td>" & _
                                "<td class=""comValue"">" & objrd.Item("contact_phone") & "</td>" & _
                            "</tr>" & _
                            "<tr>" & _
                                "<td class=""comName"">Contact Email:</td>" & _
                                "<td class=""comValue"">" & objrd.Item("contact_email") & "</td>" & _
                                "<td class=""comName"">Contact URL:</td>" & _
                                "<td class=""comValue"">" & objrd.Item("merchant_url") & "</td>" & _
                            "</tr>" & _
                            "<tr>" & _
                                "<td class=""comName"">Address1:</td>" & _
                                "<td class=""comValue"">" & objrd.Item("address1") & "</td>" & _
                                "<td class=""comName"">Address2:</td>" & _
                                "<td class=""comValue"">" & objrd.Item("address2") & "</td>" & _
                            "</tr>" & _
                            "<tr>" & _
                                "<td class=""comName"">Zip:</td>" & _
                                "<td class=""comValue"">" & objrd.Item("zip") & "</td>" & _
                            "</tr>" & _
                        "</table>"
            End If
            ps.strSql = "select * from merchant_products where company_id = @comId"
            ps.addParameter("comId", comId)
            objrd = objdt.dr(ps, strErr, conn, objrd)
            If objrd.HasRows Then
                While (objrd.Read())
                    productInfo &= "<div class=""photoItem"">" & _
                                       "<div><img src=""../assets/cn.gif"" width=""180"" height=""180""/></div>" & _
                                       "<div class=""photoItemTitle""><a href=""productdetail.aspx?productId=" & objrd.Item("product_number") & """>" & objrd.Item("product_name") & "</a></div>" & _
                                   "</div>"
                End While
            End If
            companyInformation.InnerHtml = comInfo & "<div class=""productShow"">" & _
                         "<div class=""detailSecTitle"">" & _
                             "<div class=""relativeTitle"">Products Show</div>" & _
                         "</div>" & _
                            "<div id=""photoList"">" & _
                            productInfo & _
                        "</div>" & _
                     "</div>"
            objdt.closeConn(conn)

        Else
            Response.Redirect("seller_show.aspx")
        End If
    End Sub

End Class
